import requests
import json
'''
url1 = 'https://qz.xinyan.com/#/carrierReportV2?apiUser=8150752019&apiEnc=29cccd7435359f181d6853590ebb382c&token=0076881559355568128'

response = requests.get(url1).content.decode()
print(response)
'''


url2 = 'https://qz.xinyan.com/api/user/data/report/json'

headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'
     }
## 确定请求参数
params = {
    '_':'1565751186574',
    'apiUser':'8150752019',
    'apiEnc':'29cccd7435359f181d6853590ebb382c',
    'token':'0076881559355568128',
}
response_url2 = requests.get(url2,headers=headers,params=params)
result = response_url2.text
result = json.loads(result)

## 数据
behavior_portrait_carrier = result['detail']['behavior_portrait_carrier']
user_basic_info = result['detail']['user_basic_info']
contact_analysis = result['detail']['contact_analysis']
call_location_analysis = result['detail']['call_location_analysis']
active_degree_analysis = result['detail']['active_degree_analysis']
consumption_analysis = result['detail']['consumption_analysis']
trip_analysis = result['detail']['trip_analysis']
mobile_tag_analysis = result['detail']['mobile_tag_analysis']
monthly_analysis = result['detail']['monthly_analysis']
address_book_analysis = result['detail']['address_book_analysis']
call_time_analysis = result['detail']['call_time_analysis']
call_period_analysis = result['detail']['call_period_analysis']
call_detail_analysis = result['detail']['call_detail_analysis']
sms_analysis = result['detail']['sms_analysis']

print(behavior_portrait_carrier)
